var express = require('express');
var router = express.Router();
var path = require('path');
var connectDB = require('../connectDB');
/* GET home page. */
router.get('/', function (req, res, next) {
    let pathUrl = path.join(__dirname + '.\/../../views/lxcgouwuche.html');
    res.sendFile(pathUrl);

});
router.post('/biao',async function (req, res, next) {
    var lxc = await fun1(req.body.goodId);
    res.send(lxc);
    

});


function fun1(data) {
    return new Promise((a, b) => {
        connectDB.query('SELECT * FROM sp_car  WHERE id = ?',[data],(error, results, fields) => {
            if (!error) {
                a(JSON.stringify(results));
            }
        })
    })
}
module.exports = router;